import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class DebitCardTest {
	DebitCard debit;
	@Before
	public void setUp() throws Exception {
	}
	
	@After
	public void tearDown() throws Exception {
	}
	
	@Test
	public void testDebitCardStringStringStringStringString() {
		debit = new DebitCard("Bob Smith", "1 Main St.", "12345", "Tacoma", "USA");
		assertTrue(debit.fName.equals("Bob Smith"));
	}
	
	@Test
	public void testDebitCardStringStringStringStringCheckingAccount() {
		CheckingAccount checking = new CheckingAccount("name", "street", "12587", "town", "country",5000, 357950);

		debit = new DebitCard("Bob Smith", "1 Main St.", "12345", "Tacoma", "USA", checking);
		assertTrue(debit.fName.equals("Bob Smith"));
		assertTrue(debit.fAccountConnectedTo.fDebitAllowed);
		assertTrue(debit.fAccountConnectedTo.getDebitAmount() == 5000);

	}
	
	@Test
	public void testPay() {
		CheckingAccount checking = new CheckingAccount("name", "street", "12587", "town", "country",5000, 357950);

		debit = new DebitCard("Bob Smith", "1 Main St.", "12345", "Tacoma", "USA", checking);
		assertTrue(debit.fAccountConnectedTo.fDebitAllowed);
		assertTrue(debit.fAccountConnectedTo.getDebitAmount() == 5000);
		assertTrue(debit.pay(5000));
		assertFalse(debit.pay(5000));
	}
	
}
